/**
 * Created by Adam on 2017/5/17.
 */
import React from 'react'
import PropTypes from 'prop-types'

const Link = ({children, active, onClick}) => {
    if (active) {
        return <span>{children}</span>
    }
    return <a href="#" onClick={(e) => {
        e.preventDefault()
        onClick()
    }}>{children}</a>
}

Link.propType={
    children: PropTypes.string.isRequired,
    active: PropTypes.bool.isRequired,
    onClick: PropTypes.func.isRequired
}

export default Link